﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;
using System.Data.SqlClient;

/// <summary>
/// Summary description for clsCHUONGTRINHHOC
/// </summary>
public class clsCHUONGTRINHHOC
{
	public clsCHUONGTRINHHOC()
	{
		//
		// TODO: Add constructor logic here
		//
    }

    #region Select
    public DataTable Select()
    {
        DataTable dt = new DataTable();
        DatabaseConnect connect = new DatabaseConnect();
        try         
        {
            dt = connect.GetSelectCommand("CHUONGTRINHHOC_Select", null);
        }
        catch {
            dt = null;
        }
        return dt;
    }
    #endregion

    #region "Insert"
    public string Insert(string mach, string tench)
    {
        DatabaseConnect connect = new DatabaseConnect();
        // Tham so
        SqlParameter []para = new SqlParameter[2];
        para[0] = new SqlParameter("@F_MACH", mach);
        para[1] = new SqlParameter("@F_MACHN", tench);

        try
        {
            connect.ExecuteQuery("CHUONGTRINHHOC_Insert", para);
            return "OK";
        }
        catch {
            return "ERR";
        }
    }
    #endregion

    #region Update
    public string Update(string mach, string tench)
    {
        DatabaseConnect connect = new DatabaseConnect();

        //Tham so
        SqlParameter[] para = new SqlParameter[2];
        para[0] = new SqlParameter("@F_MACH", mach);
        para[1] = new SqlParameter("@F_MACHN", tench);

        try 
        {
            connect.ExecuteQuery("CHUONGTRINHHOC_Update", para);
            return "OK";
        }
        catch {
            return "ERR";
        }
    }
    #endregion

    #region Delete
    public string Delete(string mach)
    {
        DatabaseConnect connect = new DatabaseConnect();
        // Tham so
        SqlParameter[] para = new SqlParameter[1];
        para[0] = new SqlParameter("@mach", mach);

        try {
            connect.ExecuteQuery("CHUONGTRINHHOC_Delete", para);
            return "OK";
        }
        catch {
            return "ERR";
        }
    }
    #endregion
}